Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Send flow sub components #1906

Merged
merged 31 commits into from
Feb 4, 2025
Merged

feat: Send flow sub components #1906

merged 31 commits into from
Feb 4, 2025

Conversation

brendan-defi
Copy link
Contributor

What changed? Why?

  • added subcomponents and utils for upcoming Send module

Notes to reviewers

How has it been tested?

Copy link

vercel bot commented Jan 31, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
onchainkit-coverage ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 3, 2025 10:54pm
onchainkit-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 3, 2025 10:54pm
onchainkit-routes ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 3, 2025 10:54pm

@@ -101,6 +103,7 @@ export function AmountInput({
'[appearance:textfield]',
'[&::-webkit-inner-spin-button]:m-0 [&::-webkit-inner-spin-button]:appearance-none',
'[&::-webkit-outer-spin-button]:m-0 [&::-webkit-outer-spin-button]:appearance-none',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: not related to your pr, but now that this is using a these styles shouldn't be needed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you clarify? what's being used that make which styles not needed?

);

return (
<div className="grid w-full grid-cols-[2.5rem_1fr_auto] items-center gap-3">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

base className?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

happy to add, but right now can't think of what people would want to change here. this is really just controlling the layout.

classNames.container applies to the outer element, and that can add background color, fonts, etc. what would be the purpose of adding an override here?

<div className="text-right">
{showAction ? (
<div
role="button"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better to use a button than a div that thinks its a button

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this one can't be a button because sometimes the whole TokenBalance is a button and can't nest a button inside another button

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if possible, instead of nesting the buttons i'd use styles to overlay them. Its not an idea UX regardless, but at least it'd allow you to have two interactive elements working.

showAction?: true;
actionText?: string;
onActionPress?: () => void;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if showAction, should actionText and onActionPress be required?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

refactored to this
image

Exchange rate unavailable
</div>
);
}
Copy link
Contributor

@alessey alessey Jan 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesn't AmountInputTypeSwitch already handle loading, etc, why is this wrapped necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AmountInputTypeSwitch's method for handling loading is to show an infinite blank Skeleton. I don't want that behavior.

Better to add an override to AmountInputTypeSwitch, which will default to current behavior, but into which I can pass my div?

'_blank',
'noopener,noreferrer',
);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how is this different from the default success handler?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

after it's clicked it takes an action (setting showSend to false)

}

return 'Continue';
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if this is only used with a single button, may make sense to keep this logic with the button

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah no intention to reuse this, i extracted for readability, but can add back if you prefer

return {
display: input,
value: selectedAddress,
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this may also be better suited to live where its used, could leave display '' if input is an address and render getSlicedAddress. hard to tell in this limited context.

@@ -16,6 +16,7 @@ type AmountInputProps = {
setCryptoAmount: (value: string) => void;
exchangeRate: string;
className?: string;
textClassName?: string;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could use an object structure here with classNames like dan suggested in quality TDD

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will that be a breaking change for FundCard though?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh yeah good point i guess we can revisit here and i saw you updated to classNames in other component 👍

abcrane123
abcrane123 previously approved these changes Feb 1, 2025
Copy link
Contributor

@abcrane123 abcrane123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

exchangeRateLoading,
className,
textClassName,
}: SendAmountInputProps) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should SendAmountInputProps live in this file? I think we're defaulting to that now if this is its only use

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah okay yeah that should be fine, i don't think it really needs to be reused anywhere, i was just colo'ing all types in the type file. will move back

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm actually this is reused in SendAmountInputTypeSwitch, so I think it should stay in the types file

brendan-defi

This comment was marked as outdated.

@brendan-defi brendan-defi merged commit 1c5ea6b into main Feb 4, 2025
16 checks passed
@brendan-defi brendan-defi deleted the feat/send-sub-components branch February 4, 2025 21:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

5 participants